<?php
//----------------------------------------------------------------------
// Sophia
// Sophia by Alex Olave - http://www.alfazeta.cl
//----------------------------------------------------------------------

//----------------------------------------------------------------------
// Author: 	Alex Olave - http://www.alfazeta.cl
// Copyright: copyright (C) 2012 - Alex Olave.
// License: 	GNU/GPL, http://www.gnu.org/copyleft/gpl.html
// Pack: 	Sophia
//----------------------------------------------------------------------

//----------------------------------------------------------------------
// Sophia is free software. This version may have been modified pursuant
// to the GNU General Public License, and as distributed it includes or
// is derivative of works licensed under the GNU General Public License or
// other free or open source software licenses.
//-----------------------------------------------------------------------

defined( '_JEXEC' ) or die( 'Restricted access' );

// Require the base controller and helpers
require_once( JPATH_COMPONENT.DS.'controller.php' );
require_once( JPATH_COMPONENT.DS.'helpers'.DS.'cp.helper.php' );
require_once( JPATH_COMPONENT.DS.'helpers'.DS.'load.helper.php' );
require_once( JPATH_COMPONENT.DS.'helpers'.DS.'config.helper.php' );
require_once( JPATH_COMPONENT.DS.'helpers'.DS.'credit.helper.php' );

ini_set("display_errors", nomHelperConfig::getConfig('debug_mode', 0));

// Require tables
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_sophia'.DS.'tables');

// Require specific controller if requested
if($controller = JRequest::getWord('controller')) {
	$path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php';
	if (file_exists($path)) {
		require_once $path;
	} else {
		$controller = '';
	}
}

// Create the controller
$classname    = 'SophiaController'.$controller;
$controller   = new $classname( );

// Perform the Request task
$controller->execute( JRequest::getVar( 'task' ) );

// Redirect if set by the controller
$controller->redirect();

?>
